<!DOCTYPE html>
<html lang="zh_cn">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    window.onload = () => {
      const emailList = [
        'a',
        'a@',
        'a@b',
        'a@b.',
        'a@b.c',
        'a@bc.'
      ]
      const reg = new RegExp(/^(?:[^\s]+@[^\s]+\.[^\s]+)$/, 'i')
      // 第二个参数很重要
      emailList.forEach((email, index) => {
        const testResult = reg.test(email)
        console.log(index + 1, email, testResult)
      })
    }
  </script>
</head>
<body>
  
</body>
</html>